package com.itqf.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.itqf.serializer.MySalarySerializer;
import lombok.Data;

import java.util.Date;

/**
 * @Description:
 * @Company: 千锋互联
 * @Author: 李丽婷
 * @Date: 2020/11/13
 * @Time: 下午4:02
 */
@Data
public class Users {//jackson 的注解   @JsonProperty   @JsonInclude

   // @JsonProperty("username")//响应的该字段的key变为name
    private  String username;//默认 username
   // @JsonProperty("pwd")//响应的该字段的key变为pwd
    @JsonInclude(JsonInclude.Include.NON_NULL) //为null  不响应
    //@JsonInclude(JsonInclude.Include.NON_EMPTY) //为 ""  不响应
    private  String password;//默认：password

    private   int age;

    private   int gender;//male  female

    private String[] hobby;//集合
    //@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")//Sun Oct 10 09:09:09 CST 2010
    //timezone = "GTM+8"  国标
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GTM+8")
    private Date birthday;
    @JsonIgnore  //直接忽略
    private    int   version;

    //salary字段  数据库 18888.88
    //前端： ￥18888.88元
    //对工资字段进行特殊处理
    @JsonSerialize(using = MySalarySerializer.class)
    private  double  salary;





}
